/// Copyright ©2021 Guangzhou Tianyi Network Information Co., Ltd. All rights reserved.
/// Project: PluginEchat
/// Created By Jisen
/// Date: 2021/8/24 上午10:51
/// Class description: ec_message_entity - 未读消息数据实体

class ECMessageEntity {
  String? title; // 标题
  String? content; // 内容
  bool? isNeededLocalPush; // 获取未读消息中判断是否需要进行本地推送
  int? msgType; // 类型, 1 << 0, 访客发送消息; 1 << 1, 客服消息; 1 << 2, 系统消息; 1 << 3, 所有类型

  ECMessageEntity({
    this.title,
    this.content,
    this.isNeededLocalPush,
    this.msgType,
  });

  factory ECMessageEntity.fromJson(Map<String, dynamic> json) {
    if (json == null) return null!;
    return ECMessageEntity(
      title: json['title'],
      content: json['content'],
      isNeededLocalPush: json['isNeededLocalPush'],
      msgType: json['msgType'],
    );
  }

  Map<String, dynamic> toJson() {
    Map<String, dynamic> json = new Map();

    if (title != null)
      json.putIfAbsent('title', () => title);
    if (content != null)
      json.putIfAbsent('content', () => content);
    if (isNeededLocalPush != null)
      json.putIfAbsent('isNeededLocalPush', () => isNeededLocalPush);
    if (msgType != null)
      json.putIfAbsent('msgType', () => msgType);
    return json;
  }
}